import typescript from '@rollup/plugin-typescript'
import commonjs from '@rollup/plugin-commonjs'
import pkg from './package.json'

export default {
  treeshake: true,
  perf: true,
  input: 'src/index.ts',
  output: {
    dir: 'dist',
    format: 'cjs',
    entryFileNames: '[name].js',
    exports: 'named'
  },
  plugins: [typescript(), commonjs({ extensions: ['.js'] })],
  external: [
    'fs',
    'path',
    'os',
    ...Object.keys(pkg.dependencies || {}),
    ...Object.keys(pkg.peerDependencies || {})
  ],
  watch: {
    chokidar: true,
    include: 'src/**',
    exclude: 'node_modules/**'
  }
}
